﻿#include "AcousticsAppSettings.h"

#include "FITK_Kernel/FITKCore/FITKDirFileTools.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Kernel/FITKAppFramework/FITKRunTimeSetting.h"

#include <QColor>
#include <QSettings>
#include <QFile>

void AcousticsAppSettings::read()
{
    //读入文件
    QString file = _appDir + "/AcousticsAPP.ini";
    //创建文件
    Core::CreateFile(file);
    //读取文件
    _settings = new QSettings(file, QSettings::IniFormat);

    this->initSetting();
}

void AcousticsAppSettings::initSetting()
{
    //设置原始颜色
    if (!_settings->contains("OriFluidsMaterialColor"))
        _settings->setValue("OriFluidsMaterialColor", QColor("#d1d1d1"));
    if (!_settings->contains("OriBeamPhyPropColor"))
        _settings->setValue("OriBeamPhyPropColor", QColor("#00dfca"));
    if (!_settings->contains("OriUniformPhyPropColor"))
        _settings->setValue("OriUniformPhyPropColor", QColor("#80ff00"));
    if (!_settings->contains("OriGeneralPhyProp"))
        _settings->setValue("OriGeneralPhyProp", QColor("#80ff00"));
    if (!_settings->contains("OriRibbedPhyProp"))
        _settings->setValue("OriRibbedPhyProp", QColor("#80ff00"));
    if (!_settings->contains("OriFEProperty"))
        _settings->setValue("OriFEProperty", QColor("#f0f000"));

    if (!_settings->contains("OriFEProperty")) {
        //截面颜色标记
        FITKAPP->getGlobalData()->getRunTimeSetting()->setValue("SECTIONCOLOR", Qt::UserRole + 999);
    }
}



